package com.lifeng.controller;

import com.lifeng.api.UserService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.rpc.RpcException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by lifeng on 2019/2/25.
 */
@RestController
public class UserController {
    @DubboReference(group="lifeng-dubbo", version ="1.0.0")
    private UserService userService;

    @RequestMapping("/dubbo/getUser")
    public String getUser(){
        try{
            return userService.getUserInfo("132");
        }catch (RpcException e){
            System.out.println(e.getCode());
            e.printStackTrace();
        }
        return null;
    }
}
